package edu.ccut.titan.tag.report.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import edu.ccut.titan.tag.report.design.MeasureInfo;

public class TitanMeasureTag extends TagSupport {
	private static final long serialVersionUID = 6934313094885464786L;
	private String var = "";
	private String filed = "";
	private String clazz = "java.lang.Double";
	private String functioin = "sum";
	private TitanCrosstabTag crosstabTag;
	private MeasureInfo measureInfo;

	@Override
	public int doStartTag() throws JspException {
		crosstabTag = (TitanCrosstabTag) this.getParent();
		measureInfo = new MeasureInfo();
		return EVAL_BODY_INCLUDE;
	}

	@Override
	public int doEndTag() throws JspException {
		measureInfo.setClazz(clazz);
		measureInfo.setFiled(filed);
		measureInfo.setFunctioin(functioin);
		measureInfo.setVar(var);
		crosstabTag.addMeasureInfo(measureInfo);
		return SKIP_BODY;
	}

	public String getVar() {
		return var;
	}

	public void setVar(String var) {
		this.var = var;
	}

	public String getFiled() {
		return filed;
	}

	public void setFiled(String filed) {
		this.filed = filed;
	}

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}

	public String getFunctioin() {
		return functioin;
	}

	public void setFunctioin(String functioin) {
		this.functioin = functioin;
	}

}
